﻿using Bank_database_system.业务部;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Bank_database_system
{
    public partial class 信息首页 : Form
    {
        账号管理a account_manage_a = new 账号管理a();
        操作记录a action_logging = new 操作记录a();
        支行信息a branch_inf_a = new 支行信息a();
        int button_state = 0;

        public 信息首页()
        {
            InitializeComponent();
            label4.Text = AccountCheck.name;
            label5.Text = AccountCheck.branchname;
            label1.Text = AccountCheck.staffid;
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void button6_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (button_state != 1)
            {
                // 切换按钮图像
                button1.Image = Properties.Resources.账号管理按下;
                button2.Image = Properties.Resources.操作记录;
                button3.Image = Properties.Resources.支行信息;
                //在容器中添加新空间
                panel1.Visible = true;
                panel1.Controls.Clear();
                account_manage_a = new();
                panel1.Controls.Add(account_manage_a);

                button_state = 1;
            }
            
        }

        private void 信息首页_Load(object sender, EventArgs e)
        {
            // 启动定时器
            timer1.Start();
            label3.Text = "当前时间：" + DateTime.Now.ToString("HH:mm:ss");
        }

        private void button2_Click_1(object sender, EventArgs e)
        {
            if (button_state != 2)
            {
                // 切换按钮图像
                button1.Image = Properties.Resources.账号管理;
                button2.Image = Properties.Resources.操作记录按下;
                button3.Image = Properties.Resources.支行信息;

                panel1.Visible = true;
                panel1.Controls.Clear();
                action_logging = new();
                panel1.Controls.Add(action_logging);

                button_state = 2;
            }
            
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (button_state != 3)
            {
                // 切换按钮图像
                button1.Image = Properties.Resources.账号管理;
                button2.Image = Properties.Resources.操作记录;
                button3.Image = Properties.Resources.支行信息按下;

                panel1.Visible = true;
                panel1.Controls.Clear();
                branch_inf_a = new();
                panel1.Controls.Add(branch_inf_a);

                button_state = 3;
            }
            
        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            // 更新 TextBox 的文本为当前时间
            label3.Text = "当前时间：" + DateTime.Now.ToString("HH:mm:ss");
        }

        private void label4_Click_1(object sender, EventArgs e)
        {

        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void button8_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("是否注销当前账号？", "提示", MessageBoxButtons.OKCancel);
            if (dr == DialogResult.OK)
            {
                //将窗体返回结果设置为Cancel,但并不退出系统
                this.DialogResult = DialogResult.Cancel;
                this.Close();
            }
        }

        private void button1_mouse_enter(object sender, EventArgs e)
        {
            if (button_state != 1)
            {
                // 鼠标悬停时更改图片
                button1.Image = Properties.Resources.账号管理悬停;
            }
        }

        private void button1_mouse_leave(object sender, EventArgs e)
        {
            if (button_state != 1)
            {
                // 鼠标悬停时更改图片
                button1.Image = Properties.Resources.账号管理;
            }
        }

        private void button2_mouse_enter(object sender, EventArgs e)
        {
            if (button_state != 2)
            {
                // 鼠标悬停时更改图片
                button2.Image = Properties.Resources.操作记录悬停;
            }
        }

        private void button2_mouse_leave(object sender, EventArgs e)
        {
            if (button_state != 2)
            {
                // 鼠标悬停时更改图片
                button2.Image = Properties.Resources.操作记录;
            }
        }

        private void button3_mouse_enter(object sender, EventArgs e)
        {
            if (button_state != 3)
            {
                // 鼠标悬停时更改图片
                button3.Image = Properties.Resources.支行信息悬停;
            }
        }

        private void button3_mouse_leave(object sender, EventArgs e)
        {
            if (button_state != 3)
            {
                // 鼠标悬停时更改图片
                button3.Image = Properties.Resources.支行信息;
            }
        }
    }
}
